/** ###################################################################
**     Filename  : measure.C
**     Project   : measure
**     Processor : 56F8013VFAE
**     Version   : Driver 01.14
**     Compiler  : Metrowerks DSP C Compiler
**     Date/Time : 2012-3-31, 18:53
**     Abstract  :
**         Main module.
**         This module contains user's application code.
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/
/* MODULE measure */


/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "Term1.h"
#include "Inhr1.h"
#include "AD1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
  word readAD[2];
  int i;
  long sum1,sum2;
void main(void)
{
  /* Write your local variable definition here */
  

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  AD1_Start();

  for(;;) {
    sum1=0;
    sum2=0;
    for(i=0;i<1024;i++)
    {
      AD1_GetValue16(readAD);
      sum1=sum1+(readAD[0]>>4);
      sum2=sum2+(readAD[1]>>4);    	
    }
    Term1_SendNum(sum1>>10);
    Term1_SendChar(' ');
    Term1_SendChar(' ');
    Term1_SendNum(sum2>>10);
    Term1_CRLF();

    Cpu_Delay100US(100);

  }
}

/* END measure */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.00 [04.35]
**     for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
